﻿
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace BonIt.Tests
{
    using Bon_It.Model;
    using Bon_It.Model.TransferObjects;

    using Bonit_It.ViewModel.Cashier;

    [TestClass]
    public class TestBookingEngine :TestBase
    {
        [TestMethod]
        [HostType("Moles")]
        public void TestTotalValue()
        {
            Artikel artikel = new Artikel { Bezeichnung = "Test", ID = 22, VKPreis = 1.44M };
            var bookingItem = new BookingItem(artikel, 2);
            BookingEngine  engine = new BookingEngine();
            engine.AddArticle(bookingItem);
            
            Assert.AreEqual(2.88M, engine.Total);
        }


        [TestMethod]
        [HostType("Moles")]
        public void CheckCalculationResult()
        {
            Artikel artikel = new Artikel { Bezeichnung = "Test", ID = 22, VKPreis = 1.44M };
            var bookingItem = new BookingItem(artikel, 1);
            BookingEngine  engine = new BookingEngine();
            engine.AddArticle(bookingItem);
            Assert.AreEqual(1.44M, engine.Total);
            engine.Given = 2;
            Assert.AreEqual(0.56M, engine.PayBack);
        }


        [TestMethod]
        [HostType("Moles")]
        public void TestDebitAnArticle()
        {
            
            articles.Add(new Artikel { Bezeichnung = "Test", Bestand = 10, ID = 22, VKPreis = 1.44M });
            var bookingItem = new BookingItem(articles[0], 1);
            BookingEngine  engine = new BookingEngine();
            engine.AddArticle(bookingItem);

            engine.Debit(DebitInformation.DebitTypes.Cash.ToString());   
            Assert.AreEqual(9,articles[0].Bestand);
        }



    }
}
